//********************************************* K e y w o r d M a n a g e r    C L A S S ****************************************************

function KeywordManager() {

    function NewKeywordContainer(priority, keyword) {
        this.id = IDClient;
        this.priority = priority;
        this.keyword = keyword;
    }

    function UpdatedKeywordContainer(oldKeyword, priority, keyword) {
        this.id = IDClient;
        this.oldKeyword = oldKeyword;
        this.priority = priority;
        this.keyword = keyword;
    }

    function DeletedKeywordContainer(keyword) {
        this.id = IDClient;
        this.keyword = keyword;
    }

    this.addNewKeyword = function(newPriority, newKeyword) {
        var ajax_worker = new AJAXWorker();
        var message = objectToJson(new NewKeywordContainer(newPriority, newKeyword));
        ajax_worker.sendCUDKeywordRequest("POST", message);
    };

    this.editKeyword = function(oldKeyword, priority, keyword) {
        var ajax_worker = new AJAXWorker();
        var message = objectToJson(new UpdatedKeywordContainer(oldKeyword, priority, keyword));
        ajax_worker.sendCUDKeywordRequest("PUT", message);
    };

    this.deleteKeyword = function(delKeyword) {
        var ajax_worker = new AJAXWorker();
        var message = objectToJson(new DeletedKeywordContainer(delKeyword));
        ajax_worker.sendCUDKeywordRequest("DELETE", message); 
    };
}

